﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Objects;

namespace MINERP.DAL.InfoConfig
{
    public class LoginDAL:DALBase
    {
        private static ObjectQuery<users> GetUsers()
        {
            return DataEntites.users;
        }

        public static List<users> GetUserList()
        {
            List<users> list = new List<users>();
            foreach (var item in GetUsers())
            {
                list.Add(item);
            }
            return list;
        }

        public static users GetUser(string name,string pwd)
        {
            //return DataEntites.users.FirstOrDefault(u => u.LoginName == name && u.LoginPwd == pwd && u.tb_WorkerGroup.GroupName == "系统管理员");
            using (newSampleYPDBEntities entities = new newSampleYPDBEntities())
            {
                return entities.users.FirstOrDefault(u => u.LoginName == name && u.LoginPwd == pwd && u.tb_WorkerGroup.GroupName == "系统管理员");
            }
        }

    }
}
